# Get qcustomplot version from qcustomplot/qcustomplot.h and put it in QCUSTOMPLOT_VERSION
function(qcustomplot_extract_version)
    file(READ "${CMAKE_CURRENT_LIST_DIR}/qcustomplot/qcustomplot.h" file_contents)
    string(REGEX MATCH "Version: ([0-9]+\.[0-9]+\.[0-9]+)" _ "${file_contents}")
    if(NOT CMAKE_MATCH_COUNT EQUAL 1)
        message(FATAL_ERROR "Could not extract major version number from qcustomplot/qcustomplot.h")
    endif()
    set(QCUSTOMPLOT_VERSION ${CMAKE_MATCH_1} PARENT_SCOPE)    
endfunction()
